package com.sky.config;

import com.sky.properties.MinioProperties;
import com.sky.utils.AliOssUtil;
import com.sky.utils.MinioClientUtil;
import io.minio.MinioClient;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Data
@Configuration
@Slf4j
public class MiniosConfig {

    @Bean
    @ConditionalOnMissingBean
    public MinioClientUtil miniosClientUtil(MinioProperties minioProperties){
        log.info("开始创建文件上传工具类对象：{}",minioProperties);
        return new MinioClientUtil(minioProperties.getEndpoint(),
                minioProperties.getAccessKey(),
                minioProperties.getSecretKey(),
                minioProperties.getBucketName());
    }
}
